//
//  CircleMainCollectionCell.swift
//  Gaoloumi
//
//  Created by Jasper on 3/13/16.
//  Copyright © 2016 Jasper. All rights reserved.
//

import UIKit
import Kingfisher

class CircleMainCollectionCell: UICollectionViewCell {
    @IBOutlet weak var titleImageView: UIImageView!
    
    
    @IBOutlet weak var titleLable: UILabel!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        titleLable.adjustsFontSizeToFitWidth = true
        titleImageView.layer.cornerRadius = 8
        titleImageView.layer.masksToBounds = true
    }
    
    
    func refreshView(_ city: City) {
        titleLable.text = city.name
        
        let imgFile = city.iconImage
        let urlstr = imgFile?.url
        
        if urlstr != nil {
            titleImageView.kf.setImage(with: URL(string: urlstr!)!)
        } else {
            titleImageView.image = UIImage(named: "dlwebo")
        }
    }
}
